// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    // 导航胶囊
    var that =this.globalData
    let menuByttonObject = wx.getMenuButtonBoundingClientRect()
    wx.getSystemInfo({
      success: (res) => {
        let statusBarHeight = res.statusBarHeight
        let navTop = menuByttonObject.top
        let navHeight = statusBarHeight +menuByttonObject.height + (navTop -statusBarHeight) *2
        that.navHeight =navHeight
        that.navTop =navTop
        that.windowHeight  = res.windowHeight
      },
    })
    // 登录
    wx.login({
      success: res => {
        console.log(res);
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    userInfo: null,
    url:'https://tenapi.cn/',
    bing:'https://cn.bing.com/',
    uomg:'https://api.uomg.com/',
    navHeight:'',
    navTop:'',
    windowHeight:''
  }
})
